#include <fstream>
#include <ctime>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main()
{

int t=clock(), x=0;
vector <int> arr;
ifstream fin("m1_sorted");

while (!fin.eof()){
fin >> x;
arr.push_back(x);
}
for (int i=0; i<arr.size()-1; ++i){
for (int j=0; j<arr.size()-i-1; ++j){
if (arr[j] > arr[j+1]){
x=arr[j];
arr[j] = arr[j+1];
arr[j+1] = x;
}
}
}

for (int i=0; i < arr.size(); ++i){
cout << arr[i] << " ";
}

cout << endl << clock()-t;

t=clock(), x=0;
vector arr;
ifstream fin("m2_reverse");

while (!fin.eof()){
fin >> x;
arr.push_back(x);
}
for (int i=0; i<arr.size()-1; ++i){
for (int j=0; j<arr.size()-i-1; ++j){
if (arr[j] > arr[j+1]){
x=arr[j];
arr[j] = arr[j+1];
arr[j+1] = x;
}
}
}

for (int i=0; i < arr.size(); ++i){
cout << arr[i] << " ";
}

cout << endl << clock()-t;

t=clock(), x=0;
vector arr;
ifstream fin("m3_shuffle");

while (!fin.eof()){
fin >> x;
arr.push_back(x);
}
for (int i=0; i<arr.size()-1; ++i){
for (int j=0; j<arr.size()-i-1; ++j){
if (arr[j] > arr[j+1]){
x=arr[j];
arr[j] = arr[j+1];
arr[j+1] = x;
}
}
}

for (int i=0; i < arr.size(); ++i){
cout << arr[i] << " ";
}

cout << endl << clock()-t;

return 0;
}